package com.base.user;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com.baomidou.mybatisplus.annotation.TableLogic;
import com.base.user.mapper.UserMapper;

@SpringBootTest
@RunWith(SpringRunner.class)
public class UserTest3 {
	
	@Autowired
	private UserMapper userMapper;
	
	/**
	 * 根据id逻辑删除
	 */
    @Test
    public void deleteById(){
    	//因为在删除的属性上面增加了@TableLogic注解
    	//所以在删除的时候是更新deleted为1 
    	//这个1是在配置文件配置的
    	//mybatis-plus.global-config.db-config.logic-delete-value=1
    	//UPDATE user SET deleted=1 WHERE id=? AND deleted=0 
        userMapper.deleteById(4568L);
    }
	
}
